module ActiveScaffold::Config
  class List < Base
    def initialize(core_config)
      @core = core_config

      # inherit from the core's list of columns.
      self.columns = @core.columns.collect{|c| c.name}

      # inherit from global scope
      # full configuration path is: defaults => global table => local table
      @per_page = self.class.per_page
      
      # originates here
      default_sorting_column = ActiveScaffold::DataStructures::Column.new(@core.model.table_name + '.' + @core.model.primary_key, @core.model)
      @sorting = ActiveScaffold::DataStructures::Sorting.new(@core.columns)
      @sorting.add default_sorting_column, 'ASC'

      # inherit from global scope
      @empty_field_text = self.class.empty_field_text

      @handed = self.class.handed
    end

    # actions on the :left or :right side
    cattr_accessor :handed
    @@handed = :right

    # actions default to the right side
    attr_accessor :handed
  end
end
